Skip to content

Conversation

@RobertOdrowaz
Copy link
Contributor

Migrates camera wrappers as part of flutter/flutter#119109

This PR migrates wrappers to Swift:

  • FLTCaptureDevice
  • FLTCaptureSession
  • FLTFormatUtils

In line with Swift conventions, the FLT prefixes are removed. The Default class implementations are replaced with protocol conformance on base AV classes.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates FLTCaptureDevice, FLTCaptureSession, and FLTFormatUtils classes to Swift, removing the FLT prefixes and replacing Default class implementations with protocol conformance on base AV classes. The changes include modifications to the example project and the core implementation, updating tests and adapting to the new Swift conventions. The review focuses on ensuring correctness, maintainability, and adherence to the project's coding standards.

@hellohuanlin
Copy link
Contributor

Hi, could you sweep through gemini's comment first?

@RobertOdrowaz
Copy link
Contributor Author

@hellohuanlin done, there was nothing meaningful there, a bunch of comments regarding argument names in mocks and some streight up invalid suggestions

@RobertOdrowaz RobertOdrowaz force-pushed the feature/camera-wrappers-swift-migration-part3 branch from 49ed2ce to b67ac9d Compare October 28, 2025 15:36
@stuartmorgan-g stuartmorgan-g added the triage-ios Should be looked at in iOS triage label Oct 28, 2025
@RobertOdrowaz
Copy link
Contributor Author

@hellohuanlin pls take a look at this PR again when you have some time

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good

let camera = CameraTestUtils.createTestCamera(configuration)

let range = camera.captureDevice.activeFormat.videoSupportedFrameRateRanges[0]
let range = camera.captureDevice.fltActiveFormat.videoSupportedFrameRateRanges[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we renaming it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we have to rename it if we want to use protocol extension on AVCaptureDevice instead of wrapping it. With protocol conformance the fields types are invariant so even with FLTCaptureDeviceFormat migrated to swift and AVCaptureDeviceFormat conforming to FLTCaptureDeviceFormat the AVCaptureDevice.activeFormat wouldn't match required CaptureDevice.activeFormat.

var deviceType = AVCaptureDevice.DeviceType.builtInWideAngleCamera

var activeFormat: FLTCaptureDeviceFormat {
var fltActiveFormat: FLTCaptureDeviceFormat {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is FLTCaptureDeviceFormat still in ObjC or is it migrated to Swift?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still in Objc

@RobertOdrowaz RobertOdrowaz force-pushed the feature/camera-wrappers-swift-migration-part3 branch from b67ac9d to ec7e9da Compare November 10, 2025 14:39
@RobertOdrowaz RobertOdrowaz force-pushed the feature/camera-wrappers-swift-migration-part3 branch from ec7e9da to 4bbc6a5 Compare November 11, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants